<template>
	<view class="main">
		<view class="title">请输入身份证后四位</view>
		<view class="item" @tap='KeyboarOpen'>
			<password-input :numLng='password' :plaintext=false :psdIptNum='6'></password-input>
		</view>

		<number-keyboard otherNum='X' confirmBtn tabBar ref='KeyboarHid' @input='onInput' psdLength='6'>
		</number-keyboard>
	</view>
</template>

<script>
	import numberKeyboard from '@/components/number-keyboard/number-keyboard.vue'
	import passwordInput from '@/components/password-input/password-input.vue'
	export default {
		components: {
			numberKeyboard,
			passwordInput
		},
		data() {
			return {
				password: "", //输入的内容
			}
		},
		onLoad() {
			//因为此时实例没有挂载完成，需要延迟操作
			setTimeout(() => {
				this.$refs.KeyboarHid.open()
			}, 50)
		},
		methods: {
			//打开键盘
			KeyboarOpen(e) {
				this.$refs.KeyboarHid.open();

			},
			// //有点击完成事件
			// confirm(e) {
			// 	console.log(e);
			// 	this.$refs.KeyboarHid.close()
			// },
			//输入的值
			onInput(val) {
				this.password = val;
				if(val.length==6){
					console.log("发送请求")
					this.$refs.KeyboarHid.close()
				}
			}
		}
	}
</script>

<style scoped>
	.main {
		padding: 0rpx 40rpx;
	}

	.ipt {
		border-bottom: 1rpx solid #CCCCCC;
	}

	.item {
		padding: 10rpx 0rpx;
	}

	.title {
		margin: 30rpx 0;
	}
</style>
